<?php
namespace Home\Controller;

class HeroController extends HomeController {
    public function index(){
        $this->assign('title','英雄表');
        // 筛选力量英雄 遍历到力量英雄栏
        // $data = M('hero')->where($strength)->select();
        // $this->assign('list',$data);
        $strength['h_type']='力量';
        $pic = M('icon')->where($strength)->select();
        // var_dump($pic);die;
        $this->assign('pics',$pic);
        // var_dump($pic);

        $agi['h_type']='敏捷';
        $data2 = M('hero')->where($agi)->select();
        $this->assign('agis',$data2);

        $pic2 = M('icon')->where($agi)->select();
        $this->assign('pics2',$pic2);
        // var_dump($pic2);die;

        $int['h_type']='智力';
        $data3 = M('hero')->where($int)->select();
        $this->assign('int',$data3);

        $pic3 = M('icon')->where($int)->select();
        $this->assign('pics3',$pic3);
        $this->display();
    }
    public function info(){
        $id=$_GET['id'];
        $arr['c_id'] = $id;
        $data = M('skill')->where($arr)->find();
        // var_dump($data);
        // 技能表的遍历
        $this->assign('title',$data['h_name']);
        $this->assign('s1',$data['s_name1']);
        $this->assign('s2',$data['s_name2']);
        $this->assign('s3',$data['s_name3']);
        $this->assign('s4',$data['s_name4']);
        $this->assign('d1',$data['s_detail1']);
        $this->assign('d2',$data['s_detail2']);
        $this->assign('d3',$data['s_detail3']);
        $this->assign('d4',$data['s_detail4']);
        $this->assign('bg',$data['s_bg']);
        //图像表的遍历分配数据
        $where['c_id'] = $id;
        $head = M('icon')->where($where)->find();
        $this->assign('pic',$head['icon']);
        $this->assign('si1',$head['s1_icon']);
        $this->assign('si2',$head['s2_icon']);
        $this->assign('si3',$head['s3_icon']);
        $this->assign('si4',$head['s4_icon']);
        $this->display('Info/index');
    }
}